﻿using Assets.Script.Data.EnemyData;
using Assets.Script.Human.Player;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


namespace Assets.Script.Human.Enemy.Enemys
{
    public class AttackColider : MonoBehaviour
    {
        EnemyData enemyData;
        Transform enemyBodyTransform;
        public void Init(EnemyBody enemyBody)
        {
            this.enemyData = enemyBody.Data;
            this.enemyBodyTransform = enemyBody.transform;
        }

        private void OnTriggerEnter(Collider collision)
        {
            if (collision.gameObject.CompareTag("Player"))
            {
                collision.gameObject.GetComponent<HumanInterface>().TakeDamage(enemyData.Damage, 0, 0, enemyBodyTransform.position);
            }
        }
    }
}

